// 统一封装接口
//导入自己的axios
import axios from "./axios";

//获取菜单列表 （树形）
const menuListTree=()=>{
    return axios.get('/menulist?istree=1')
}
//删除菜单
const menuDel=(id)=>{
    return axios.post('/menudelete',{id})
}
//修改菜单
const menuEdit=(data)=>{
    return axios.post('/menuedit',data)
}
//获取角色列表
const roleList=()=>{
    return axios.get('/rolelist')
}
//添加角色
const roleAdd=(data)=>{
    return axios.post('/roleadd',data)
}
//删除角色 
const roleDel=(id)=>{
    return axios.post('/roledelete',{id})
}
//修改角色信息
const roleEdit=(data)=>{
    return axios.post('/roleedit',data)
}
//获取管理员列表
const userList=(data)=>{
    return axios.get('/userlist',{
        params:data
    })
}
//获取管理员总数
const getUserCount=()=>{
    return axios('/usercount')
}
//添加管理员
const userAdd=(data)=>{
    return axios.post('/useradd',data)
}
//修改管理员
const userEdit=(data)=>{
    return axios.post('/useredit',data)
}
//删除管理员
const userDel=(uid)=>{
    return axios.post('/userdelete',{uid})
}
//获取商品分类列表
const categoryList=()=>{
    return axios.get('/catelist?istree=1')
}
//商品分类，二级
const categoryInfo=(id)=>{
    return axios.get('/catelist',{params:{pid:id}})
}
//商品分类添加
const categoryAdd=(data)=>{
    return axios.post('/cateadd',data)
}
//商品分类修改
const categoryEdit=(data)=>{
    return axios.post('/cateedit',data)
}
//商品分类删除
const categoryDel=(id)=>{
    return axios.post('/catedelete',{id})
}
//商品规格列表
const spaceList=(data)=>{
    return axios.get('/specslist',{
        params:data
    })
}
//获取商品规格总数
const getSpecsCount=()=>{
    return axios('/specscount')
}
//增加商品规格
const specsAdd=(data)=>{
    return axios.post('/specsadd',data)
}
//修改商品规格
const specsEdit=(data)=>{
    return axios.post('/specsedit',data)
}
//删除商品规格
const specsDel=(id)=>{
    return axios.post('/specsdelete',{id})
}
//获取商品规格信息
const specsInfo=(id)=>{
    return axios.get('/specsinfo',{params:{id}})
}
//会员管理列表
const memberList=()=>{
    return axios.get('/memberlist')
}
//商品列表总数
const goodsCount=()=>{
    return axios.get('/goodscount')
}
//商品列表
const goodsList=(data)=>{
    return axios.get('/goodslist',{
        params:data
    })
}
//商品添加
const goodsAdd=(data)=>{
    return axios.post('/goodsadd',data)
}
//商品修改
const goodsEdit=(data)=>{
    return axios.post('/goodsedit',data)
}
//商品删除
const goodsDel=(id)=>{
    return axios.post('/goodsdelete',{id})
}
//轮播图列表
const getBannerList=()=>{
    return axios.get('/bannerlist')
}
//轮播图增加
const BannerAdd=(data)=>{
    return axios.post('/banneradd',data)
}
//轮播图修改
const BannerEdit=(data)=>{
    return axios.post('/banneredit',data)
}
//秒杀活动列表
const getSeckList=()=>{
    return axios.get('/secklist')
}
//添加秒杀活动
const seckillAdd=(data)=>{
    return axios.post('/seckadd',data)
}
//修改秒杀活动
const seckillEdit=(data)=>{
    return axios.post('/seckedit',data)
}
//
const seckillDel=(id)=>{
    return axios.post('/seckdelete',{
        id
    })
}
export {
    menuListTree,
    menuDel,
    menuEdit,
    roleList,
    roleAdd,
    roleDel,
    roleEdit,
    userList,
    getUserCount,
    userAdd,
    userEdit,
    userDel,
    categoryList,
    categoryAdd,
    categoryEdit,
    categoryDel,
    spaceList,
    getSpecsCount,
    specsAdd,
    specsEdit,
    specsDel,
    memberList,
    goodsCount,
    goodsList,
    categoryInfo,
    specsInfo,
    goodsAdd,
    goodsEdit,
    goodsDel,
    getBannerList,
    BannerAdd,
    BannerEdit,
    getSeckList,
    seckillAdd,
    seckillEdit,
    seckillDel
}